<?php

namespace App\Clients\YikaCar;

use GuzzleHttp\Exception\GuzzleException;
use phpQuery;

class YikaBike extends YikaCarClient
{
    protected $isJson = false;

    public function handleData(): void
    {
        $html = phpQuery::newDocument($this->contents);
        $data = [
            "income"=>$html->find(".cont-main .row:eq(1) .col-xs-2:eq(3)")->text()
        ];
        preg_match('/\d+(\.\d+)?/', $data["income"], $matches);
        $data["income"] = $matches[0];
        $this->contents = $data;
    }

    /**
     * @throws GuzzleException
     */
    public function execute($queryData): YikaBike
    {
        return $this->get("http://leader.szyika.com/Index/order.html",$queryData);
    }
}
